/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.component;

import java.awt.FlowLayout;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;

import com.ruipengkj.commons.util.Util;
/**
 * 说明：
 * 文本+输入框
 * @Author：李智深
 * @Date：2012-03-14
 */
public class JLabelJRadioButtonComponent extends JPanel{
	
	private static final long serialVersionUID = 1L;
	private JRadioButton jRadioButton;
	private JRadioButton cardNumRadio,phoneRadio;
	JRadioButton r1 = new JRadioButton("是",true);
    JRadioButton r2 = new JRadioButton("否");
	
    public Boolean getSelect(){
    	if(r1.isSelected()){
    		return true;
    	}else{
    		return false;
    	}
    }
    public void setSelect(String s){
    	if(s.equals("1")){
    		//return true;
    		r1.setSelected(true);
    	}else{
    		r2.setSelected(true);
    		//return false;
    	}
    }
	//private Dimension dimension=null;
	public JLabelJRadioButtonComponent(String lable,int width){
		this.setLayout(new FlowLayout(FlowLayout.LEFT));
		this.setOpaque(false);
		
		//dimension=new Dimension(width, 25);
		JLabel label=new JLabel(lable);
		jRadioButton=new JRadioButton();
		//jRadioButton.setOpaque(true);
		jRadioButton.setBackground(Util.PANEL_COLOR);
		ButtonGroup bg = new ButtonGroup();
		bg.add(r1);
		bg.add(r2);
		r1.setOpaque(false);
		r2.setOpaque(false);
		//jRadioButton.add(r1);
		//jRadioButton.add(r2);
		this.add(label);
		this.add(r1);
		this.add(r2);
		//this.add(jRadioButton);
	}
	
	public void addYesActionListener(ActionListener _listener)
	{
		r1.addActionListener(_listener);
	}
	public void addNoActionListener(ActionListener _listener){
		r2.addActionListener(_listener);
	}

	public JRadioButton getJRadioButton() {
		return jRadioButton;
	}

	public void setJRadioButton(JRadioButton radioButton) {
		jRadioButton = radioButton;
	}
}
